home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - portable sources / interp / parser.tab.c < prev    next >
Encoding:
Text File  |  1995-03-15  |  17.6 KB  |  745 lines  |  [TEXT/ttxt]

  1.  
  2. # line 33 "../../mindy-1.x/interp/parser.y"
  3. #include "../compat/std-c.h"
  4.  
  5. #include "mindy.h"
  6. #include "lexer.h"
  7. #include "parser.h"
  8. #include "list.h"
  9. #include "str.h"
  10. #include "sym.h"
  11. #include "num.h"
  12. #include "bool.h"
  13.  
  14.  
  15. static void yyerror(char *);
  16.  
  17. static obj_t result;
  18.  
  19. #ifdef __cplusplus
  20. #  include <stdio.h>
  21.    extern "C" {
  22.      extern void yyerror(char *);
  23.      extern int yylex();
  24.    }
  25. #endif    /* __cplusplus */ 
  26. # define tok_TRUE 257
  27. # define tok_FALSE 258
  28. # define tok_ERROR 259
  29. # define tok_LPAREN 260
  30. # define tok_RPAREN 261
  31. # define tok_DEBUGVAR 262
  32. # define tok_ARG 263
  33. # define tok_NUMBER 264
  34. # define tok_CHARACTER 265
  35. # define tok_STRING 266
  36. # define tok_ADDRESS 267
  37. # define tok_SYMBOL 268
  38. # define tok_KEYWORD 269
  39. # define tok_COMMA 270
  40. #define yyclearin yychar = -1
  41. #define yyerrok yyerrflag = 0
  42. extern int yychar;
  43. #ifndef YYMAXDEPTH
  44. #define YYMAXDEPTH 150
  45. #endif
  46.  
  47. /* __YYSCLASS defines the scoping/storage class for global objects
  48.  * that are NOT renamed by the -p option.  By default these names
  49.  * are going to be 'static' so that multi-definition errors
  50.  * will not occur with multiple parsers.
  51.  * If you want (unsupported) access to internal names you need
  52.  * to define this to be null so it implies 'extern' scope.
  53.  * This should not be used in conjunction with -p.
  54.  */
  55. #ifndef __YYSCLASS
  56. # define __YYSCLASS static
  57. #endif
  58. #ifndef YYSTYPE
  59. #define YYSTYPE int
  60. #endif
  61. YYSTYPE yylval;
  62. __YYSCLASS YYSTYPE yyval;
  63. typedef int yytabelem;
  64. # define YYERRCODE 256
  65.  
  66. # line 129 "../../mindy-1.x/interp/parser.y"
  67.  
  68.  
  69. static void yyerror(char *msg)
  70. {
  71.     yyinput_clear();
  72. }
  73.  
  74. YYSTYPE parse_command(FILE *input)
  75. {
  76.     extern int yyparse();
  77.     yyinput_setter(input);
  78.     return yyparse() ? obj_False : result;
  79. }
  80.  
  81. __YYSCLASS yytabelem yyexca[] ={
  82. -1, 0,
  83.     0, 3,
  84.     -2, 0,
  85. -1, 1,
  86.     0, -1,
  87.     -2, 0,
  88.     };
  89. # define YYNPROD 26
  90. # define YYLAST 62
  91. __YYSCLASS yytabelem yyact[]={
  92.  
  93.     12,    13,    26,     3,    22,     8,     9,    17,    16,    15,
  94.     18,    10,    25,    12,    13,     4,    27,    11,     8,     9,
  95.     17,    16,    15,    18,    10,    25,    12,    13,    23,     6,
  96.     20,     8,     9,    17,    16,    15,    18,    10,    14,    20,
  97.     28,     5,     7,     2,     1,     0,    31,     0,     0,    19,
  98.     24,     0,     0,     0,     0,    29,     0,    30,    24,     0,
  99.      0,    21 };
  100. __YYSCLASS yytabelem yypact[]={
  101.  
  102.   -253, -3000,  -231, -3000, -3000, -3000,  -221, -3000, -3000, -3000,
  103.  -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000, -3000,  -231,
  104.   -257, -3000, -3000,  -259,  -230,  -231, -3000, -3000,  -244,  -230,
  105.  -3000, -3000 };
  106. __YYSCLASS yytabelem yypgo[]={
  107.  
  108.      0,    44,    43,    41,    29,    42,    28,    17,    16 };
  109. __YYSCLASS yytabelem yyr1[]={
  110.  
  111.      0,     1,     1,     1,     1,     2,     3,     3,     4,     4,
  112.      4,     5,     5,     5,     5,     7,     7,     7,     7,     7,
  113.      7,     7,     6,     6,     8,     8 };
  114. __YYSCLASS yytabelem yyr2[]={
  115.  
  116.      0,     5,     3,     1,     3,     2,     3,     7,     3,     7,
  117.      9,     3,     3,     3,     3,     3,     3,     2,     2,     2,
  118.      2,     2,     5,     7,     1,     5 };
  119. __YYSCLASS yytabelem yychk[]={
  120.  
  121.  -3000,    -1,    -2,   256,   268,    -3,    -4,    -5,   262,   263,
  122.    268,    -7,   257,   258,   269,   266,   265,   264,   267,   270,
  123.    260,    -3,   261,    -6,    -4,   269,   261,    -8,   270,    -4,
  124.     -6,    -8 };
  125. __YYSCLASS yytabelem yydef[]={
  126.  
  127.     -2,    -2,     2,     4,     5,     1,     6,     8,    11,    12,
  128.     13,    14,    15,    16,    17,    18,    19,    20,    21,     0,
  129.      0,     7,     9,     0,    24,    17,    10,    22,     0,    24,
  130.     25,    23 };
  131. typedef struct { char *t_name; int t_val; } yytoktype;
  132. #ifndef YYDEBUG
  133. #    define YYDEBUG    0    /* don't allow debugging */
  134. #endif
  135.  
  136. #if YYDEBUG
  137.  
  138. __YYSCLASS yytoktype yytoks[] =
  139. {
  140.     "tok_TRUE",    257,
  141.     "tok_FALSE",    258,
  142.     "tok_ERROR",    259,
  143.     "tok_LPAREN",    260,
  144.     "tok_RPAREN",    261,
  145.     "tok_DEBUGVAR",    262,
  146.     "tok_ARG",    263,
  147.     "tok_NUMBER",    264,
  148.     "tok_CHARACTER",    265,
  149.     "tok_STRING",    266,
  150.     "tok_ADDRESS",    267,
  151.     "tok_SYMBOL",    268,
  152.     "tok_KEYWORD",    269,
  153.     "tok_COMMA",    270,
  154.     "-unknown-",    -1    /* ends search */
  155. };
  156.  
  157. __YYSCLASS char * yyreds[] =
  158. {
  159.     "-no such reduction-",
  160.     "start : command exprlist",
  161.     "start : command",
  162.     "start : /* empty */",
  163.     "start : error",
  164.     "command : tok_SYMBOL",
  165.     "exprlist : expr",
  166.     "exprlist : expr tok_COMMA exprlist",
  167.     "expr : leaf",
  168.     "expr : expr tok_LPAREN tok_RPAREN",
  169.     "expr : expr tok_LPAREN arglist tok_RPAREN",
  170.     "leaf : tok_DEBUGVAR",
  171.     "leaf : tok_ARG",
  172.     "leaf : tok_SYMBOL",
  173.     "leaf : literal",
  174.     "literal : tok_TRUE",
  175.     "literal : tok_FALSE",
  176.     "literal : tok_KEYWORD",
  177.     "literal : tok_STRING",
  178.     "literal : tok_CHARACTER",
  179.     "literal : tok_NUMBER",
  180.     "literal : tok_ADDRESS",
  181.     "arglist : expr more_args",
  182.     "arglist : tok_KEYWORD expr more_args",
  183.     "more_args : /* empty */",
  184.     "more_args : tok_COMMA arglist",
  185. };
  186. #endif /* YYDEBUG */
  187. #define YYFLAG  (-3000)
  188. /* @(#) $Revision: 70.7 $ */    
  189.  
  190. /*
  191. ** Skeleton parser driver for yacc output
  192. */
  193.  
  194. #if defined(NLS) && !defined(NL_SETN)
  195. #include <msgbuf.h>
  196. #endif
  197.  
  198. #ifndef nl_msg
  199. #define nl_msg(i,s) (s)
  200. #endif
  201.  
  202. /*
  203. ** yacc user known macros and defines
  204. */
  205. #define YYERROR        goto yyerrlab
  206.  
  207. #ifndef __RUNTIME_YYMAXDEPTH
  208. #define YYACCEPT    return(0)
  209. #define YYABORT        return(1)
  210. #else
  211. #define YYACCEPT    {free_stacks(); return(0);}
  212. #define YYABORT        {free_stacks(); return(1);}
  213. #endif
  214.  
  215. #define YYBACKUP( newtoken, newvalue )\
  216. {\
  217.     if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
  218.     {\
  219.         yyerror( (nl_msg(30001,"syntax error - cannot backup")) );\
  220.         goto yyerrlab;\
  221.     }\
  222.     yychar = newtoken;\
  223.     yystate = *yyps;\
  224.     yylval = newvalue;\
  225.     goto yynewstate;\
  226. }
  227. #define YYRECOVERING()    (!!yyerrflag)
  228. #ifndef YYDEBUG
  229. #    define YYDEBUG    1    /* make debugging available */
  230. #endif
  231.  
  232. /*
  233. ** user known globals
  234. */
  235. int yydebug;            /* set to 1 to get debugging */
  236.  
  237. /*
  238. ** driver internal defines
  239. */
  240. /* define for YYFLAG now generated by yacc program. */
  241. /*#define YYFLAG        (FLAGVAL)*/
  242.  
  243. /*
  244. ** global variables used by the parser
  245. */
  246. # ifndef __RUNTIME_YYMAXDEPTH
  247. __YYSCLASS YYSTYPE yyv[ YYMAXDEPTH ];    /* value stack */
  248. __YYSCLASS int yys[ YYMAXDEPTH ];        /* state stack */
  249. # else
  250. __YYSCLASS YYSTYPE *yyv;            /* pointer to malloc'ed value stack */
  251. __YYSCLASS int *yys;            /* pointer to malloc'ed stack stack */
  252.  
  253. #if defined(__STDC__) || defined (__cplusplus)
  254. #include <stdlib.h>
  255. #else
  256.     extern char *malloc();
  257.     extern char *realloc();
  258.     extern void free();
  259. #endif /* __STDC__ or __cplusplus */
  260.  
  261.  
  262. static int allocate_stacks(); 
  263. static void free_stacks();
  264. # ifndef YYINCREMENT
  265. # define YYINCREMENT (YYMAXDEPTH/2) + 10
  266. # endif
  267. # endif    /* __RUNTIME_YYMAXDEPTH */
  268. long  yymaxdepth = YYMAXDEPTH;
  269.  
  270. __YYSCLASS YYSTYPE *yypv;            /* top of value stack */
  271. __YYSCLASS int *yyps;            /* top of state stack */
  272.  
  273. __YYSCLASS int yystate;            /* current state */
  274. __YYSCLASS int yytmp;            /* extra var (lasts between blocks) */
  275.  
  276. int yynerrs;            /* number of errors */
  277. __YYSCLASS int yyerrflag;            /* error recovery flag */
  278. int yychar;            /* current input token number */
  279.  
  280.  
  281.  
  282. /*
  283. ** yyparse - return 0 if worked, 1 if syntax error not recovered from
  284. */
  285. int
  286. yyparse()
  287. {
  288.     register YYSTYPE *yypvt;    /* top of value stack for $vars */
  289.  
  290.     /*
  291.     ** Initialize externals - yyparse may be called more than once
  292.     */
  293. # ifdef __RUNTIME_YYMAXDEPTH
  294.     if (allocate_stacks()) YYABORT;
  295. # endif
  296.     yypv = &yyv[-1];
  297.     yyps = &yys[-1];
  298.     yystate = 0;
  299.     yytmp = 0;
  300.     yynerrs = 0;
  301.     yyerrflag = 0;
  302.     yychar = -1;
  303.  
  304.     goto yystack;
  305.     {
  306.         register YYSTYPE *yy_pv;    /* top of value stack */
  307.         register int *yy_ps;        /* top of state stack */
  308.         register int yy_state;        /* current state */
  309.         register int  yy_n;        /* internal state number info */
  310.  
  311.         /*
  312.         ** get globals into registers.
  313.         ** branch to here only if YYBACKUP was called.
  314.         */
  315.     yynewstate:
  316.         yy_pv = yypv;
  317.         yy_ps = yyps;
  318.         yy_state = yystate;
  319.         goto yy_newstate;
  320.  
  321.         /*
  322.         ** get globals into registers.
  323.         ** either we just started, or we just finished a reduction
  324.         */
  325.     yystack:
  326.         yy_pv = yypv;
  327.         yy_ps = yyps;
  328.         yy_state = yystate;
  329.  
  330.         /*
  331.         ** top of for (;;) loop while no reductions done
  332.         */
  333.     yy_stack:
  334.         /*
  335.         ** put a state and value onto the stacks
  336.         */
  337. #if YYDEBUG
  338.         /*
  339.         ** if debugging, look up token value in list of value vs.
  340.         ** name pairs.  0 and negative (-1) are special values.
  341.         ** Note: linear search is used since time is not a real
  342.         ** consideration while debugging.
  343.         */
  344.         if ( yydebug )
  345.         {
  346.             register int yy_i;
  347.  
  348.             printf( "State %d, token ", yy_state );
  349.             if ( yychar == 0 )
  350.                 printf( "end-of-file\n" );
  351.             else if ( yychar < 0 )
  352.                 printf( "-none-\n" );
  353.             else
  354.             {
  355.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  356.                     yy_i++ )
  357.                 {
  358.                     if ( yytoks[yy_i].t_val == yychar )
  359.                         break;
  360.                 }
  361.                 printf( "%s\n", yytoks[yy_i].t_name );
  362.             }
  363.         }
  364. #endif /* YYDEBUG */
  365.         if ( ++yy_ps >= &yys[ yymaxdepth ] )    /* room on stack? */
  366.         {
  367. # ifndef __RUNTIME_YYMAXDEPTH
  368.             yyerror( (nl_msg(30002,"yacc stack overflow")) );
  369.             YYABORT;
  370. # else
  371.             /* save old stack bases to recalculate pointers */
  372.             YYSTYPE * yyv_old = yyv;
  373.             int * yys_old = yys;
  374.             yymaxdepth += YYINCREMENT;
  375.             yys = (int *) realloc(yys, yymaxdepth * sizeof(int));
  376.             yyv = (YYSTYPE *) realloc(yyv, yymaxdepth * sizeof(YYSTYPE));
  377.             if (yys==0 || yyv==0) {
  378.                 yyerror( (nl_msg(30002,"yacc stack overflow")) );
  379.                 YYABORT;
  380.                 }
  381.             /* Reset pointers into stack */
  382.             yy_ps = (yy_ps - yys_old) + yys;
  383.             yyps = (yyps - yys_old) + yys;
  384.             yy_pv = (yy_pv - yyv_old) + yyv;
  385.             yypv = (yypv - yyv_old) + yyv;
  386. # endif
  387.  
  388.         }
  389.         *yy_ps = yy_state;
  390.         *++yy_pv = yyval;
  391.  
  392.         /*
  393.         ** we have a new state - find out what to do
  394.         */
  395.     yy_newstate:
  396.         if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
  397.             goto yydefault;        /* simple state */
  398. #if YYDEBUG
  399.         /*
  400.         ** if debugging, need to mark whether new token grabbed
  401.         */
  402.         yytmp = yychar < 0;
  403. #endif
  404.         if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  405.             yychar = 0;        /* reached EOF */
  406. #if YYDEBUG
  407.         if ( yydebug && yytmp )
  408.         {
  409.             register int yy_i;
  410.  
  411.             printf( "Received token " );
  412.             if ( yychar == 0 )
  413.                 printf( "end-of-file\n" );
  414.             else if ( yychar < 0 )
  415.                 printf( "-none-\n" );
  416.             else
  417.             {
  418.                 for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
  419.                     yy_i++ )
  420.                 {
  421.                     if ( yytoks[yy_i].t_val == yychar )
  422.                         break;
  423.                 }
  424.                 printf( "%s\n", yytoks[yy_i].t_name );
  425.             }
  426.         }
  427. #endif /* YYDEBUG */
  428.         if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
  429.             goto yydefault;
  430.         if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar )    /*valid shift*/
  431.         {
  432.             yychar = -1;
  433.             yyval = yylval;
  434.             yy_state = yy_n;
  435.             if ( yyerrflag > 0 )
  436.                 yyerrflag--;
  437.             goto yy_stack;
  438.         }
  439.  
  440.     yydefault:
  441.         if ( ( yy_n = yydef[ yy_state ] ) == -2 )
  442.         {
  443. #if YYDEBUG
  444.             yytmp = yychar < 0;
  445. #endif
  446.             if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
  447.                 yychar = 0;        /* reached EOF */
  448. #if YYDEBUG
  449.             if ( yydebug && yytmp )
  450.             {
  451.                 register int yy_i;
  452.  
  453.                 printf( "Received token " );
  454.                 if ( yychar == 0 )
  455.                     printf( "end-of-file\n" );
  456.                 else if ( yychar < 0 )
  457.                     printf( "-none-\n" );
  458.                 else
  459.                 {
  460.                     for ( yy_i = 0;
  461.                         yytoks[yy_i].t_val >= 0;
  462.                         yy_i++ )
  463.                     {
  464.                         if ( yytoks[yy_i].t_val
  465.                             == yychar )
  466.                         {
  467.                             break;
  468.                         }
  469.                     }
  470.                     printf( "%s\n", yytoks[yy_i].t_name );
  471.                 }
  472.             }
  473. #endif /* YYDEBUG */
  474.             /*
  475.             ** look through exception table
  476.             */
  477.             {
  478.                 register int *yyxi = yyexca;
  479.  
  480.                 while ( ( *yyxi != -1 ) ||
  481.                     ( yyxi[1] != yy_state ) )
  482.                 {
  483.                     yyxi += 2;
  484.                 }
  485.                 while ( ( *(yyxi += 2) >= 0 ) &&
  486.                     ( *yyxi != yychar ) )
  487.                     ;
  488.                 if ( ( yy_n = yyxi[1] ) < 0 )
  489.                     YYACCEPT;
  490.             }
  491.         }
  492.  
  493.         /*
  494.         ** check for syntax error
  495.         */
  496.         if ( yy_n == 0 )    /* have an error */
  497.         {
  498.             /* no worry about speed here! */
  499.             switch ( yyerrflag )
  500.             {
  501.             case 0:        /* new error */
  502.                 yyerror( (nl_msg(30003,"syntax error")) );
  503.                 yynerrs++;
  504.                 goto skip_init;
  505.             yyerrlab:
  506.                 /*
  507.                 ** get globals into registers.
  508.                 ** we have a user generated syntax type error
  509.                 */
  510.                 yy_pv = yypv;
  511.                 yy_ps = yyps;
  512.                 yy_state = yystate;
  513.                 yynerrs++;
  514.             skip_init:
  515.             case 1:
  516.             case 2:        /* incompletely recovered error */
  517.                     /* try again... */
  518.                 yyerrflag = 3;
  519.                 /*
  520.                 ** find state where "error" is a legal
  521.                 ** shift action
  522.                 */
  523.                 while ( yy_ps >= yys )
  524.                 {
  525.                     yy_n = yypact[ *yy_ps ] + YYERRCODE;
  526.                     if ( yy_n >= 0 && yy_n < YYLAST &&
  527.                         yychk[yyact[yy_n]] == YYERRCODE)                    {
  528.                         /*
  529.                         ** simulate shift of "error"
  530.                         */
  531.                         yy_state = yyact[ yy_n ];
  532.                         goto yy_stack;
  533.                     }
  534.                     /*
  535.                     ** current state has no shift on
  536.                     ** "error", pop stack
  537.                     */
  538. #if YYDEBUG
  539. #    define _POP_ "Error recovery pops state %d, uncovers state %d\n"
  540.                     if ( yydebug )
  541.                         printf( _POP_, *yy_ps,
  542.                             yy_ps[-1] );
  543. #    undef _POP_
  544. #endif
  545.                     yy_ps--;
  546.                     yy_pv--;
  547.                 }
  548.                 /*
  549.                 ** there is no state on stack with "error" as
  550.                 ** a valid shift.  give up.
  551.                 */
  552.                 YYABORT;
  553.             case 3:        /* no shift yet; eat a token */
  554. #if YYDEBUG
  555.                 /*
  556.                 ** if debugging, look up token in list of
  557.                 ** pairs.  0 and negative shouldn't occur,
  558.                 ** but since timing doesn't matter when
  559.                 ** debugging, it doesn't hurt to leave the
  560.                 ** tests here.
  561.                 */
  562.                 if ( yydebug )
  563.                 {
  564.                     register int yy_i;
  565.  
  566.                     printf( "Error recovery discards " );
  567.                     if ( yychar == 0 )
  568.                         printf( "token end-of-file\n" );
  569.                     else if ( yychar < 0 )
  570.                         printf( "token -none-\n" );
  571.                     else
  572.                     {
  573.                         for ( yy_i = 0;
  574.                             yytoks[yy_i].t_val >= 0;
  575.                             yy_i++ )
  576.                         {
  577.                             if ( yytoks[yy_i].t_val
  578.                                 == yychar )
  579.                             {
  580.                                 break;
  581.                             }
  582.                         }
  583.                         printf( "token %s\n",
  584.                             yytoks[yy_i].t_name );
  585.                     }
  586.                 }
  587. #endif /* YYDEBUG */
  588.                 if ( yychar == 0 )    /* reached EOF. quit */
  589.                     YYABORT;
  590.                 yychar = -1;
  591.                 goto yy_newstate;
  592.             }
  593.         }/* end if ( yy_n == 0 ) */
  594.         /*
  595.         ** reduction by production yy_n
  596.         ** put stack tops, etc. so things right after switch
  597.         */
  598. #if YYDEBUG
  599.         /*
  600.         ** if debugging, print the string that is the user's
  601.         ** specification of the reduction which is just about
  602.         ** to be done.
  603.         */
  604.         if ( yydebug )
  605.             printf( "Reduce by (%d) \"%s\"\n",
  606.                 yy_n, yyreds[ yy_n ] );
  607. #endif
  608.         yytmp = yy_n;            /* value to switch over */
  609.         yypvt = yy_pv;            /* $vars top of value stack */
  610.         /*
  611.         ** Look in goto table for next state
  612.         ** Sorry about using yy_state here as temporary
  613.         ** register variable, but why not, if it works...
  614.         ** If yyr2[ yy_n ] doesn't have the low order bit
  615.         ** set, then there is no action to be done for
  616.         ** this reduction.  So, no saving & unsaving of
  617.         ** registers done.  The only difference between the
  618.         ** code just after the if and the body of the if is
  619.         ** the goto yy_stack in the body.  This way the test
  620.         ** can be made before the choice of what to do is needed.
  621.         */
  622.         {
  623.             /* length of production doubled with extra bit */
  624.             register int yy_len = yyr2[ yy_n ];
  625.  
  626.             if ( !( yy_len & 01 ) )
  627.             {
  628.                 yy_len >>= 1;
  629.                 yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  630.                 yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  631.                     *( yy_ps -= yy_len ) + 1;
  632.                 if ( yy_state >= YYLAST ||
  633.                     yychk[ yy_state =
  634.                     yyact[ yy_state ] ] != -yy_n )
  635.                 {
  636.                     yy_state = yyact[ yypgo[ yy_n ] ];
  637.                 }
  638.                 goto yy_stack;
  639.             }
  640.             yy_len >>= 1;
  641.             yyval = ( yy_pv -= yy_len )[1];    /* $$ = $1 */
  642.             yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
  643.                 *( yy_ps -= yy_len ) + 1;
  644.             if ( yy_state >= YYLAST ||
  645.                 yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
  646.             {
  647.                 yy_state = yyact[ yypgo[ yy_n ] ];
  648.             }
  649.         }
  650.                     /* save until reenter driver code */
  651.         yystate = yy_state;
  652.         yyps = yy_ps;
  653.         yypv = yy_pv;
  654.     }
  655.     /*
  656.     ** code supplied by user is placed in this switch
  657.     */
  658.     switch( yytmp )
  659.     {
  660.         
  661. case 1:
  662. # line 70 "../../mindy-1.x/interp/parser.y"
  663. { result = pair(yypvt[-1],yypvt[-0]); } break;
  664. case 2:
  665. # line 72 "../../mindy-1.x/interp/parser.y"
  666. { result = pair(yypvt[-0],obj_Nil); } break;
  667. case 3:
  668. # line 74 "../../mindy-1.x/interp/parser.y"
  669. { result = obj_Nil; } break;
  670. case 4:
  671. # line 76 "../../mindy-1.x/interp/parser.y"
  672. { result = make_byte_string("command error: try ``help''"); } break;
  673. case 6:
  674. # line 83 "../../mindy-1.x/interp/parser.y"
  675. { yyval = list1(yypvt[-0]); } break;
  676. case 7:
  677. # line 85 "../../mindy-1.x/interp/parser.y"
  678. { yyval = pair(yypvt[-2], yypvt[-0]); } break;
  679. case 8:
  680. # line 89 "../../mindy-1.x/interp/parser.y"
  681. { yyval = yypvt[-0]; } break;
  682. case 9:
  683. # line 91 "../../mindy-1.x/interp/parser.y"
  684. { yyval = list2(symbol("funcall"), yypvt[-2]); } break;
  685. case 10:
  686. # line 93 "../../mindy-1.x/interp/parser.y"
  687. { yyval = pair(symbol("funcall"), pair(yypvt[-3], yypvt[-1])); } break;
  688. case 11:
  689. # line 97 "../../mindy-1.x/interp/parser.y"
  690. { yyval = pair(symbol("debug-var"), yypvt[-0]); } break;
  691. case 12:
  692. # line 99 "../../mindy-1.x/interp/parser.y"
  693. { yyval = pair(symbol("arg"), yypvt[-0]); } break;
  694. case 13:
  695. # line 101 "../../mindy-1.x/interp/parser.y"
  696. { yyval = pair(symbol("variable"), yypvt[-0]); } break;
  697. case 14:
  698. # line 103 "../../mindy-1.x/interp/parser.y"
  699. { yyval = pair(symbol("literal"), yypvt[-0]); } break;
  700. case 15:
  701. # line 107 "../../mindy-1.x/interp/parser.y"
  702. { yyval = obj_True; } break;
  703. case 16:
  704. # line 109 "../../mindy-1.x/interp/parser.y"
  705. { yyval = obj_False; } break;
  706. case 22:
  707. # line 118 "../../mindy-1.x/interp/parser.y"
  708. { yyval = pair(yypvt[-1], yypvt[-0]); } break;
  709. case 23:
  710. # line 120 "../../mindy-1.x/interp/parser.y"
  711. { yyval = pair(pair(symbol("literal"),yypvt[-2]),pair(yypvt[-1], yypvt[-0])); } break;
  712. case 24:
  713. # line 124 "../../mindy-1.x/interp/parser.y"
  714. { yyval = obj_Nil; } break;
  715. case 25:
  716. # line 126 "../../mindy-1.x/interp/parser.y"
  717. { yyval = yypvt[-0]; } break;
  718.     }
  719.     goto yystack;        /* reset registers in driver code */
  720. }
  721.  
  722. # ifdef __RUNTIME_YYMAXDEPTH
  723.  
  724. static int allocate_stacks() {
  725.     /* allocate the yys and yyv stacks */
  726.     yys = (int *) malloc(yymaxdepth * sizeof(int));
  727.     yyv = (YYSTYPE *) malloc(yymaxdepth * sizeof(YYSTYPE));
  728.  
  729.     if (yys==0 || yyv==0) {
  730.        yyerror( (nl_msg(30004,"unable to allocate space for yacc stacks")) );
  731.        return(1);
  732.        }
  733.     else return(0);
  734.  
  735. }
  736.  
  737.  
  738. static void free_stacks() {
  739.     if (yys!=0) free((char *) yys);
  740.     if (yyv!=0) free((char *) yyv);
  741. }
  742.  
  743. # endif  /* defined(__RUNTIME_YYMAXDEPTH) */
  744.  
  745.